
const fs = require('fs');
let date = new Date();
let data1 = date.getFullYear() + "-" + ((date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)) + "-" +
    (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + " " +
    (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ":" +
    (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ":" +
    (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
// console.log(date.getMonth());

let data2 = data1 + '\n';
fs.appendFileSync('test.log', data2, 'utf-8');